package com.lb.jwitter.action;


import java.util.ArrayList;
import java.util.Collection;
import java.util.List;

import org.springframework.context.support.ClassPathXmlApplicationContext;
import java.util.Map; 
import org.springframework.beans.factory.annotation.Autowired;
import com.lb.jwitter.util.ApplicationContextProvider; 
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext; 
import org.springframework.test.context.ContextConfiguration;
 import com.opensymphony.xwork2.ActionContext; 
import com.opensymphony.xwork2.Action; 
import com.lb.jwitter.service.ConditionReport;
import com.lb.jwitter.service.TblQLDTTXADMThangDiem;
import com.lb.jwitter.service.TblQLDTTXADMThangDiemService;
import com.lb.jwitter.service.TblQuyenChiTietService;import com.lb.jwitter.service.TblTaiKhoan;import com.lb.jwitter.service.TblQLDTTXAHoSoXetTuyen;
import com.lb.jwitter.service.TblQLDTTXAHoSoXetTuyenService;
import com.lb.jwitter.service.TblQLDTTXAThongBaoTuyenSinh;
import com.lb.jwitter.service.TblQLDTTXAThongBaoTuyenSinhService;

import com.lb.jwitter.service.TblQLDTTXADMChiNhanh;
import com.lb.jwitter.service.TblQLDTTXADMChiNhanhService;

import com.lb.jwitter.service.TblQLDTTXADMKhoa;
import com.lb.jwitter.service.TblQLDTTXADMKhoaService;

import com.lb.jwitter.service.TblQLDTTXADMNganh;
import com.lb.jwitter.service.TblQLDTTXADMNganhService;

 /** 
 * @author QUOCVIET  
 * 
 */ 


@ContextConfiguration(locations="classpath:beans.xml") 
public class TblQLDTTXAHoSoDiemXetTuyenAddFormAction{
    private int id; 
    public void setId(int id) {
       this.id = id;
 }

    public int getId() {
       return id;
 }
    private int hoSoId; 
    public void setHoSoId(int id) {
       this.hoSoId = id;
 }

    public int getHoSoId() {
       return hoSoId;
 }

    
    private TblQLDTTXAHoSoXetTuyen tblQLDTTXAHoSoXetTuyen; 
    public TblQLDTTXAHoSoXetTuyen  getTblQLDTTXAHoSoXetTuyen() {
        return tblQLDTTXAHoSoXetTuyen;
 }

    private TblQLDTTXAHoSoXetTuyenService tblQLDTTXAHoSoXetTuyenService; 
    
    private Collection<TblQLDTTXADMThangDiem> tblQLDTTXADMThangDiems; 
    public Collection<TblQLDTTXADMThangDiem> getTblQLDTTXADMThangDiems() {
         return this.tblQLDTTXADMThangDiems; 
    }

    private TblQLDTTXADMThangDiemService tblQLDTTXADMThangDiemService; 

  private TblTaiKhoan taiKhoanDangNhap; 
 public TblTaiKhoan getTaiKhoanDangNhap() { 
     return taiKhoanDangNhap; 
 } 
 public void setTaiKhoanDangNhap(TblTaiKhoan taiKhoanDangNhap) { 
     this.taiKhoanDangNhap = taiKhoanDangNhap; 
 } 
 private TblQuyenChiTietService tblQuyenChiTietService;
	 @Autowired // Injected by Spring 
     ApplicationContextProvider contextProvider; 
 public String execute() throws Exception 
{ 
 try{ 	
     Map session = ActionContext.getContext().getSession();
     taiKhoanDangNhap =  (TblTaiKhoan) session.get("taiKhoan");
     if( taiKhoanDangNhap == null) return "noprivilege";
    ApplicationContext context = ApplicationContextProvider.getApplicationContext(); 
    tblQuyenChiTietService = (TblQuyenChiTietService) context.getBean("tbl_Quyen_ChiTietClient"); 
    if(!tblQuyenChiTietService.checkRight(taiKhoanDangNhap.getMaNhomQuyen().getId(), "tbl_QLDTTXA_HoSo_DiemXetTuyen", "them")){ 
        return "noprivilege"; 
    }
    tblQLDTTXAHoSoXetTuyenService = (TblQLDTTXAHoSoXetTuyenService) context.getBean("tbl_QLDTTXA_HoSoXetTuyenClient");
    tblQLDTTXADMThangDiemService = (TblQLDTTXADMThangDiemService) context.getBean("tbl_QLDTTXA_DM_ThangDiemClient");
    tblQLDTTXADMThangDiems = tblQLDTTXADMThangDiemService.findAlltblQLDTTXADMThangDiem(0, 0);    
    //if(hoSoId != 0 ){ 
    	tblQLDTTXAHoSoXetTuyen = tblQLDTTXAHoSoXetTuyenService.gettblQLDTTXAHoSoXetTuyen(new Long(hoSoId)) ;
    //} 
       
        
        return Action.SUCCESS; 
      } 
      catch(Exception e){ 
      System.out.println("Loi AddForm tbl_QLDTTXA_HoSo_DiemXetTuyen Action"); 
     e.printStackTrace(); 
    return Action.ERROR; 
 } 
 } 
 } 
 
